package com.qf.hospital.service.impl;

import com.qf.hospital.entity.RegisteredType;
import com.qf.hospital.mapper.RegisteredTypeMapper;
import com.qf.hospital.service.RegisterTypeService;
import com.qf.hospital.vo.RegisterTypeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * @version V1.0
 * @Project hospital
 * @Package com.qf.hospital.service.impl
 * @Description: ${TODO}
 * @Date 2021/10/20 15:34
 */

@Service
public class RegisterTypeServiceImpl implements RegisterTypeService {

    @Autowired
    private RegisteredTypeMapper registeredTypeMapper;

    @Override
    public List<RegisterTypeVO> findRegisterType() {
        List<RegisteredType> list = registeredTypeMapper.selectByExample(null);

        List<RegisterTypeVO> data = new ArrayList<>();
        for (RegisteredType registeredType : list) {
            RegisterTypeVO vo = new RegisterTypeVO(registeredType.getId(),registeredType.getType());
            data.add(vo);
        }
        return data;
    }

    @Override
    public Integer findRegMoneyByRegisterId(Integer registeredId) {
        return registeredTypeMapper.findRegMoneyByRegisterId(registeredId);
    }
}
